package com.ningxia.water.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * hz
 */
@Data
@EqualsAndHashCode(callSuper = false)
@JsonIgnoreProperties(value = { "handler" })
@Accessors(chain = true)
public class SysRoleTable implements Serializable {

    private static final long serialVersionUID = 1L;
    @TableId(value = "role_id", type = IdType.AUTO)
    private Integer roleId;

    private String roleName;

    private String description;


    public SysRoleTable() {
    }

    public SysRoleTable(Integer roleId, String roleName) {
        this.roleId = roleId;
        this.tranRoleName(roleName);
    }

    public SysRoleTable(Integer roleId, String roleName, String description) {
        this.roleId = roleId;
        this.tranRoleName(roleName);
        this.description = description;
    }

    private void tranRoleName(String roleName) {
        if (roleName.indexOf("ROLE_") == -1) {
            this.roleName = "ROLE_" + roleName;
        } else {
            this.roleName = roleName;
        }
    }


}

